s = input()
while True:
    try:
        n = int(input())
        if n >=1:
            break
    except:
        print('操作不合规，请重试！')
result = ""
for c in s:
    if c.islower():
        result += chr((ord(c) - ord('a') + n) % 26 + ord('a'))
    elif c.isupper():
        result += chr((ord(c) - ord('A') + n) % 26 + ord('A'))
    else:
        result += c
print(result)
# import string
# text = input()
# offset = int(input())
# before = string. ascii_lowercase
# after = before[offset:] + before[: offset]
# table =' '. maketrans(before, after)
# code_text = text. translate(table)
# print(code_text)